<template>
  <div class="card-container">
    <div class="card">
      <div class="card-tit" contenteditable="true">
        xssaxasxasxasxsaxcascascascascascascsacascascascsa
      </div>
      <div class="card-ctn">
        <textarea
          class="ctn-textarea"
          placeholder="此处输入便签内容"
          autocomplete="off"
        >
              我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容我是便签内容
          </textarea
        >
      </div>
      <div class="card-info">2022-01-3 16:00</div>
      <div class="card-btn">
        <div class="btn">保存</div>
        <div class="btn">据对</div>
      </div>
    </div>
    <!-- <span class="close"></span> -->
    <span class="close" @click="closeCard">×</span>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import createMessage from "@/components/CreateMessage";

export default defineComponent({
  emits: ["close-card"],
  setup(props, context) {
    function closeCard() {
      console.log("closeCard --- card");
      context.emit("close-card", 123);
      console.log("123456");
    }
    return {
      closeCard,
    };
  },
});
</script>
<style lang="scss" scoped>
.card-container {
  z-index: 9999;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.5);
}
.card {
  position: absolute;
  top: 100px;
  left: 100px;
  right: 100px;
  bottom: 100px;
  background-color: #fff;
  padding: 20px 20px 20px 20px;
  border-radius: 5px;
  word-break: break-all;
  display: flex;
  flex-direction: column;
}
.card-tit {
  padding-bottom: 10px;
  font-size: 24px;
  font-weight: 600;
}
.card-ctn {
  padding-bottom: 20px;
  flex: 1;
}
.ctn-textarea {
  width: 100%;
  height: 100%;
  min-height: 100px;
}
.card-info {
  text-align: right;
  color: rgba(0, 0, 0, 0.4);
  font-size: 12px;
  padding-bottom: 10px;
}
.card-btn {
  display: flex;
  justify-content: end;
}
.card-btn {
  .btn:last-child {
    margin-right: 0;
  }
  .btn {
    margin-right: 20px;
    border-radius: 4px;
    display: table;
    padding: 4px 10px;
    background: #06f;
    color: #fff;
  }
}
// 实现叉叉图标
/* .close {
    position: absolute;
    top: 30px;
    right: 40px;
    display: inline-block;
    width: 20px;
    height: 4px;
    background: #fff;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    &::after{
        content: "";
        display: block;
        width: 20px;
        height: 4px;
        background: red;
        transform: rotate(-90deg);
        -webkit-transform: rotate(-90deg);
    }
} */
.close {
  cursor: pointer;
  position: absolute;
  top: 20px;
  right: 40px;
  font-size: 36px;
  color: #fff;
  line-height: 34px;
  vertical-align: middle;
  transition: 0.2s all;
  &:hover {
    font-size: 46px;
  }
}
</style>
